Las Reliquias de Tolti Aph

An interactive fiction by Graham Nelson (2005) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section 3(f) - Golpes

The to-hit roll is a number that varies.

To modify to-hit roll by (amount - a number) for (reason - text):
    if the amount >= 0, say ", +[amount] por [reason]";
    otherwise say ", [amount] por [reason]";
    increase the to-hit roll by the amount.

Calculating combat modifiers of something is an activity.

For calculating combat modifiers of the player:
    modify to-hit roll by the level of the player for "tu nivel";
    continue the activity.

To make (attacker - a person) strike a blow against (defender - a person):
    [ELIUK BLAU: esta linea producía "El globlin *ataca* te ataca", era un bug.]
    [if the attacker is the player, say "Atacas "; otherwise say "[The attacker] ataca ";]
    if the attacker is the player, say "Atacas "; otherwise say "[The attacker] ";
    if the defender is the player, say "te ataca, "; otherwise say "[al defender], ";
    let the damage done be the unarmed combat hit dice of the attacker;
    if the attacker carries a weapon
    begin;
        let the instrument be the savagest weapon carried by the attacker;
        let the damage done be the hit dice of the instrument;
        say "[technique of the instrument] [the instrument]";
    otherwise;
        say hand-to-hand combat method of the attacker;
    end if;
    change the to-hit roll to a random number from 1 to 20;
    say ", haciendo una tirada de ataque (1d20) de [to-hit roll]";
    carry out the calculating combat modifiers activity with the attacker;
    if the instrument is a weapon and the to-hit bonus of the instrument is not 0, modify to-hit roll by the to-hit bonus of the instrument for "empuñar un arma bendecida";
    if the to-hit roll <= 2
    begin;
        say " - fracaso crítico (2 o menos): ";
        if the instrument is a weapon
        begin;
            if the attacker is the player
            begin;
                silently try dropping the instrument;
                if the player does not carry the instrument, say [the instrument] cae al suelo!";
                otherwise say [the instrument] vibra violentamente en tus manos!";
            otherwise;
                now the instrument is in the location;
                say [the attacker] pierde [the instrument]!";
            end if;
        otherwise;
            decrease the strength of the attacker by 1;
            if the attacker is the player
            begin;
                say "¡te has hecho daño!";
                if the player is killed, end the game saying "Has fenecido en una muerte sin gloria";
            otherwise;
                say [the attacker] ruge con impotente furia!";
            end if;
        end if;
        stop;
    end if;
    if the to-hit roll <= 10
    begin;
        say " - fracaso (3 a 10): ¡no hay daño!";
        stop;
    end if;
    if the to-hit roll <= 19
    begin;
        say " - éxito (11 a 19), ocasionando [damage done] de daño de: ";
        let the hits be the roll of the damage done;
        if the hits is 1, say " punto"; otherwise say " puntos";
    otherwise;
        say " - daño crítico (20 o más), haciendo [damage done] el doble de daño: ";
        let the hits be the roll of the damage done;
        let the hits be the hits multiplied by 2;
        say ", multiplicando por dos hasta [hits] puntos en total";
    end if;
    let the counter-charm be the defensive charm of the attacker;
    if the defender is affected by the counter-charm
    begin;
        say ", protegido por el hechizo [counter-charm].";
        stop;
    end if;
    make the defender take hits points of damage.